package access;

import main.Console;

final public class commandList {	
	static final String[] commands = {
		"su",
		"login",
		"logout"
	};
	
	static final int matchCommands(String a_text) {
		boolean b = false;
		for(int i = 0;i < commands.length;i++) {
			b = commands[i].equalsIgnoreCase(a_text);
			if(b)
				return i;
		}
		return -1;
	}
	
	public static final boolean execute(Console a_Ref,String a_text) {
		int index = matchCommands(a_text);
		switch(index) {
		case 0: //su
			a_Ref.submitEntryReq(Request_Types.SU);
			return true;
		case 1: //Login
			a_Ref.submitEntryReq(Request_Types.LOGIN);
			return true;
		case 2: //Logout
			a_Ref.submitEntryReq(Request_Types.LOGOUT);
			return true;
		}
		return false;
	}
}